xen.git
15 years agotools/hotplug: Linux udev rules adjustment
Jan Beulich [Tue, 21 Sep 2010 14:59:01 +0000 (15:59 +0100)]
tools/hotplug: Linux udev rules adjustment

While earlier this year some work was done to eliminate libxc's
creation of nodes under /dev (as in some cases it actually got
things wrong), I just found that tapdisk2 does exactly the same.
While I'm not currently aiming at removing this code, I want to
at least suggest some adjustments to the provided rules file.

First of all, the present rule

KERNEL=="blktap[0-9]*", NAME="xen/%k"

matches both blktap1's devices and blktap2's ring devices,
resulting in whoever comes last replacing what was there
before (e.g. a tap2:aio: attach will replace bltap1's
/dev/blktap0 [i.e. the main control device] with the ring device
of the new virtual disk). Therefore we should add a subsystem
qualifier there.

Second, at some udev versions default to using 0660 as the
permissions on nodes it creates. The kernel (with devtmpfs)
defaults to 0600, and hence I'd suggest to also make this
explicit in the rules.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
Cc: Boris Derzhavets <bderzhavets@yahoo.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
15 years agotools, build system: Detect distro-variant directories at build-time
Ian Jackson [Tue, 21 Sep 2010 11:17:04 +0000 (12:17 +0100)]
tools, build system: Detect distro-variant directories at build-time

In b59f87f56b1e, the defaults for some of the directory config
variables implicitly changed.  In this commit we arrange for the
defaults to be auto-detected (with the same logic as the run-time
scripts use).

This will make the build more likely to produce answers which the
builder intends.  (And, in particular, it should un-break the
automated tests, which didn't set these variables explicitly and
therefore got broken by b59f87f56b1e.)

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
15 years agox86: Retry do_mmu_update() a few times when called on a pte whose type is in flux.
Keir Fraser [Mon, 20 Sep 2010 19:11:43 +0000 (20:11 +0100)]
x86: Retry do_mmu_update() a few times when called on a pte whose type is in flux.

This can really happen -- all our PV Linux kernels have a race
between vmalloc_sync_all() and pgdir pinning/unpinning. The former is
protected by pgd_lock while the latter by mm->page_table_lock. Hence
they can happen concurrently, and vmalloc_sync_all() can attempt to
set_pmd() on a page directory which is in the process of being
pinned. This can confuse the hypervisor which may see a type change,
and hence fail do_mmu_update(). Until this patch. :-)

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
15 years agox86/hvm: fix extra size passed to __trace_var()
Keir Fraser [Mon, 20 Sep 2010 17:53:18 +0000 (18:53 +0100)]
x86/hvm: fix extra size passed to __trace_var()

While removing the casts on the last arguments to __trace_var() I
noticed the bogus addition of 1 here.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
15 years agoEliminate unnecessary casts from __trace_var() invocations
Keir Fraser [Mon, 20 Sep 2010 17:52:48 +0000 (18:52 +0100)]
Eliminate unnecessary casts from __trace_var() invocations

This is possible now that its last parameter's type is 'const void *'.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
15 years agoia64: fix gcc 4.5 warnings
Keir Fraser [Mon, 20 Sep 2010 17:51:19 +0000 (18:51 +0100)]
ia64: fix gcc 4.5 warnings

Signed-off-by: Jan Beulich <jbeulich@novell.com>
15 years agox86: protect MSI-X table and pending bit array from guest writes
Keir Fraser [Mon, 20 Sep 2010 17:50:38 +0000 (18:50 +0100)]
x86: protect MSI-X table and pending bit array from guest writes

These structures are used by Xen, and hence guests must not be able
to fiddle with them.

qemu-dm currently plays with the MSI-X table, requiring Dom0 to
still have write access. This is broken (explicitly allowing the guest
write access to the mask bit) and should be fixed in qemu-dm, at which
time Dom0 won't need any special casing anymore.

The changes are made under the assumption that p2m_mmio_direct will
only ever be used for order 0 pages.

An open question is whether dealing with pv guests (including the
IOMMU-less case) is necessary, as handling mappings a domain may
already have in place at the time the first interrupt gets set up
would require scanning all of the guest's L1 page table pages.
Currently a hole still remains allowing PV guests to map these ranges
before actually setting up any MSI-X vector for a device.

An alternative would be to determine and insert the address ranges
earlier into mmio_ro_ranges, but that would require a hook in the
PCI config space writes, which is particularly problematic in case
MMCONFIG accesses are being used.

A second alternative would be to require Dom0 to report all devices
(or at least all MSI-X capable ones) regardless of whether they would
be used by that domain, and do so after resources got determined/
assigned for them (i.e. a second notification later than the one
currently happening from the PCI bus scan would be needed).

Signed-off-by: Jan Beulich <jbeulich@novell.com>
Acked-by: Jiang, Yunhong <yunhong.jiang@intel.com>
15 years agorangesets: add function to query for overlaps
Keir Fraser [Mon, 20 Sep 2010 17:50:06 +0000 (18:50 +0100)]
rangesets: add function to query for overlaps

Signed-off-by: Jan Beulich <jbeulich@novell.com>
15 years agosched_credit: Raise bar for inter-socket migrations on mostly-idle systems
Keir Fraser [Mon, 20 Sep 2010 17:49:15 +0000 (18:49 +0100)]
sched_credit: Raise bar for inter-socket migrations on mostly-idle systems

The credit scheduler ties to keep work balanced, even on a mostly idle
system.  Unfortunately, if you have one VM burning cpu and another VM
idle, the effect is that the busy VM will flip back and forth between
sockets.

This patch addresses this, by only migrating to a different socket if
the number of idle processors is twice that of the socket the vcpu is
currently on.

This will only affect mostly-idle systems; as the system becomes more
busy, other load-balancing code will come into effect.

Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
15 years agotools, build system: Make changing distro-specific layout aspects easier
<bruce.edge@gmail.com> [Mon, 20 Sep 2010 16:54:25 +0000 (17:54 +0100)]
tools, build system: Make changing distro-specific layout aspects easier

Introduce CONFIG_LEAF_DIR, SUBSYS_DIR, INITD_DIR variables to cope
better with variation between distributions.

See docs/misc/distro_mapping.txt for details.

Signed-off-by: Bruce Edge <bruce.edge@gmail.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
15 years agolibxl: fix Makefiles for autogenerated code (use multi-target patterns)
Jan Beulich [Mon, 20 Sep 2010 15:57:08 +0000 (16:57 +0100)]
libxl: fix Makefiles for autogenerated code (use multi-target patterns)

Building in a tree with read-only source files failed because the flex/
bison generated files are left in place.

All of the source files (instead of all of the object files) were
depending on libxl.h (in particular forcing the needless re-generation
of the flex/bison generated files).

For _libxl_types.[ch] a single non-pattern rule was used. For non-
pattern rules with multiple targets, other than for pattern ones, the
body gets executed once for each target, causing problems when building
with -j<n>, <n> >= 2. Convert this rule to a pattern one.

The flex/bison generated headers pointlessly depended on the
corresponding source files. Use multiple-target pattern rules instead.

It would also have been nice if the minimal flex/bison versions needed
to successfully build libxl were documented: neither flex 2.5.31 nor
bison 2.1 (as found e.g. on SLE10) is sufficient.

Signed-off-by: Jan Beulich <jbeulich@novell.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
15 years agox86_32: [un]map_domain_page() is now IRQ safe.
Keir Fraser [Sat, 18 Sep 2010 07:57:15 +0000 (08:57 +0100)]
x86_32: [un]map_domain_page() is now IRQ safe.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
15 years agox86: Fix indentation in irq.c.
Keir Fraser [Sat, 18 Sep 2010 07:34:15 +0000 (08:34 +0100)]
x86: Fix indentation in irq.c.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
15 years agox86: irq_enter()/irq_exit() covers all of do_IRQ().
Keir Fraser [Sat, 18 Sep 2010 07:31:55 +0000 (08:31 +0100)]
x86: irq_enter()/irq_exit() covers all of do_IRQ().

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
15 years agohvm pmtimer: correct pmtimer accuracy
Keir Fraser [Fri, 17 Sep 2010 15:59:21 +0000 (16:59 +0100)]
hvm pmtimer: correct pmtimer accuracy

Several seconds of backward time drift per minute can be seen on a
RHEL6 HVM guest by switching the clocksource to 'acpi_pm' and then
running gettimeofday() in a loop. This is due to the accumulation
of small inaccuracies that are caused by shifting out the lower 32
bits when pmt_update_time() computes 'tmr_val'.

The patch makes sure that the lower 32 bits of the computed value
are not lost. They are saved in a new field 'not_accounted' in the
PMTState structure and are accounted the next time pmt_update_time()
is called.

From: Ulrich Obergfell <uobergfe@redhat.com>
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
15 years agox86_32: Fix build by fixing prototype of hvmemul_do_pio().
Keir Fraser [Fri, 17 Sep 2010 15:44:00 +0000 (16:44 +0100)]
x86_32: Fix build by fixing prototype of hvmemul_do_pio().

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
15 years agopython: xl: stub out libxl_cpuid_policy_list accessors
Ian Campbell [Fri, 17 Sep 2010 15:12:13 +0000 (16:12 +0100)]
python: xl: stub out libxl_cpuid_policy_list accessors

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
15 years agoxl: correct vcpu-pin and vcpu-list parameter checking
Juergen Gross [Thu, 16 Sep 2010 17:29:26 +0000 (18:29 +0100)]
xl: correct vcpu-pin and vcpu-list parameter checking

attached patch corrects parameter checking of vcpu-pin and vcpu-list
sub-commands.

Signed-off-by: Juergen Gross <juergen.gross@ts.fujitsu.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
15 years agolibxl: introduce cpuid interface to domain build
Andre Przywara [Thu, 16 Sep 2010 17:02:40 +0000 (18:02 +0100)]
libxl: introduce cpuid interface to domain build

Add a cpuid parameter into libxl_domain_build_info and use
it's content while setting up the domain. This is a only paving the way,
the real functionality is implemented in the later patches.

Signed-off-by: Andre Przywara <andre.przywara@amd.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
15 years agolibxl: Clear device-model info when destroying an HVM domain with stubdom.
Jun Zhu [Thu, 16 Sep 2010 16:49:43 +0000 (17:49 +0100)]
libxl: Clear device-model info when destroying an HVM domain with stubdom.

Signed-off-by: Jun Zhu <Jun.Zhu@citrix.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
15 years agolibxl: fix compiler warning with fork_exec_bootloader
Andre Przywara [Thu, 16 Sep 2010 16:39:33 +0000 (17:39 +0100)]
libxl: fix compiler warning with fork_exec_bootloader

At least one of my compilers complains about the broken const
qualifier in the fork_exec_bootloader() call (despite the cast).
Fix this properly by propagating the const attribute down the
call stack.

Signed-off-by: Andre Przywara <andre.przywara@amd.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
15 years agolibxl, tools/python: Add libxl python binding
Gianni Tedesco [Thu, 16 Sep 2010 16:20:22 +0000 (17:20 +0100)]
libxl, tools/python: Add libxl python binding

Introduce python binding for libxl. The binding is not yet complete but
serveral methods are implemented and tested. Those which are implemented
provide examples of the two or three basic patterns that most future
methods should follow.

Over 5,000 lines of boilerplate is automatically generated to wrap and
export all relevant libxl structure definitions. There are a few places
where such code cannot be fully auto-generated and special hooks are
declared and stubbed where, for example, conversion between
libxl_file_reference and a python file object is required.

Signed-off-by: Gianni Tedesco <gianni.tedesco@citrix.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
15 years agolibxl: change IDL to export a saner interface for upcoming language bindings
Gianni Tedesco [Thu, 16 Sep 2010 16:12:21 +0000 (17:12 +0100)]
libxl: change IDL to export a saner interface for upcoming language bindings

Firstly remove an anonymous union in libxl_device_pci structure which
was making auto-generating language bindings more complicated than
necessary and exporting random bits of low level ABI that libxl that
would rather hide anyway. There is a corresponding (untested) change to
the ocaml binding which maintains previous ml API.

Secondly make the libxl_file_reference type a Builtin. This is a
'semantic
correctness' issue in that libxl ABI/API won't change. But it makes it
so that when the IDL is used to generate language bindings that a
file_reference type is not exported.

Also implement a Numeric type which all integers are derived from. Make
sure a boolean signed/unsigned attribute is set accordingly. This is
required to allow language bindings to correctly handle the sign bit in
environments with arbitrarily long integers.

Signed-off-by: Gianni Tedesco <gianni.tedesco@citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
15 years agoRemove unused function console_force_lock().
Keir Fraser [Thu, 16 Sep 2010 09:02:14 +0000 (10:02 +0100)]
Remove unused function console_force_lock().

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
15 years agovmx: Annotate update_guest_eip() callers with safety analysis
Keir Fraser [Wed, 15 Sep 2010 15:52:31 +0000 (16:52 +0100)]
vmx: Annotate update_guest_eip() callers with safety analysis
for access to VM_EXIT_INSTRUCTION_LEN

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
15 years agovmx: __update_guest_eip(__guest_instruction_length()) -> update_guest_eip()
Keir Fraser [Wed, 15 Sep 2010 15:05:50 +0000 (16:05 +0100)]
vmx: __update_guest_eip(__guest_instruction_length()) -> update_guest_eip()

Signed-off-by: Eddie Dong <eddie.dong@intel.com>
15 years agomem_event: Clean up and remove over-sized paused_vcpus[] array.
Keir Fraser [Wed, 15 Sep 2010 14:45:42 +0000 (15:45 +0100)]
mem_event: Clean up and remove over-sized paused_vcpus[] array.

This cuts the size of the domain structure by around 30kB! It is now a
little over a page in size.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
15 years agox86 hvm: Clean up PIO fast path emulation.
Keir Fraser [Wed, 15 Sep 2010 13:03:26 +0000 (14:03 +0100)]
x86 hvm: Clean up PIO fast path emulation.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
15 years agoC6 state with EOI issue fix for some Intel processors
Keir Fraser [Wed, 15 Sep 2010 08:00:35 +0000 (09:00 +0100)]
C6 state with EOI issue fix for some Intel processors

There is an errata in some of Intel processors.

AAJ72. EOI Transaction May Not be Sent if Software Enters Core C6
During an Interrupt Service Routine

If core C6 is entered after the start of an interrupt service routine
but before a write to the APIC EOI register, the core may not send an
EOI transaction (if needed) and further interrupts from the same
priority level or lower may be blocked.

This patch fix this issue, by checking if ISR is pending before enter
deep Cx state. If so, it would use power->safe_state instead of deep
Cx state to prevent the above issue happen.

Signed-off-by: Sheng Yang <sheng@linux.intel.com>
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
15 years agonotify_via_xen_event_channel() should check for dying domain.
Keir Fraser [Wed, 15 Sep 2010 07:18:53 +0000 (08:18 +0100)]
notify_via_xen_event_channel() should check for dying domain.

Else we can fail on either ASSERTion in that function.

From: Olaf Hering <olaf@aepfle.de>
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
15 years agox86: restore handling of "reboot=no"
Keir Fraser [Wed, 15 Sep 2010 06:48:27 +0000 (07:48 +0100)]
x86: restore handling of "reboot=no"

Somewhere between 3.2 and 3.3 this got dropped (as I noticed on a
[rarely used] box that didn't crash on me since then).

Signed-off-by: Jan Beulich <jbeulich@novell.com>
15 years agox86: fix debug key 'i' handling with no IO-APICs
Keir Fraser [Wed, 15 Sep 2010 06:47:54 +0000 (07:47 +0100)]
x86: fix debug key 'i' handling with no IO-APICs

Signed-off-by: Jan Beulich <jbeulich@novell.com>
15 years agosvm: simplify MSR handling
Keir Fraser [Wed, 15 Sep 2010 06:45:25 +0000 (07:45 +0100)]
svm: simplify MSR handling

Machine check MSRs are not special to long mode.  Thus move them into
svm_msr_write_intercept().  Remove empty long mode msr function and
simplify the logic.

Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
15 years agoQEMU_TAG update
Ian Jackson [Tue, 14 Sep 2010 17:26:10 +0000 (18:26 +0100)]
QEMU_TAG update

15 years agoxl: fix memory management of migration_domname_r
Ian Jackson [Tue, 14 Sep 2010 17:25:15 +0000 (18:25 +0100)]
xl: fix memory management of migration_domname_r

During migration, the domain name from the config file is swapped out
and replaced with a different name (with the "--incoming" suffix),
which we return to the caller.  The memory management arrangements
here were broken.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
15 years agotools/python: Replace python string exceptions with ValueError exceptions
Matthias Klose [Tue, 14 Sep 2010 16:46:21 +0000 (17:46 +0100)]
tools/python: Replace python string exceptions with ValueError exceptions

There are at least some syntax errors when trying to use the xen utils with
python2.6.  The attached patch changes these string exception into
ValueErrors:

   - tools/python/xen/util/bugtool.py (getBugTitle)
   - tools/python/xen/xend (class XendBase): not catched
   - tools/python/xen/xm/xenapi_create.py (sxp2xmlconvert_sxp_to_xml):
     the method already raises a ValueError for similiar condition.
   - tools/python/xen/xm/main.py (xm_network_attach): not catched.

For all but maybe the first one, the replacement of the string
exceptions into ValueErrors seems to be safe.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
15 years agox86 mca: unmap broken memory in EPT guest in MCA delayed handler
Keir Fraser [Mon, 13 Sep 2010 16:48:19 +0000 (17:48 +0100)]
x86 mca: unmap broken memory in EPT guest in MCA delayed handler

When a memory owned by EPT guest is broken, we change the P2M type to
be broken memory type, so that later access from the guest to the
broken memory will be trapped as EPT violation.

Signed-off-by: Jiang, Yunhong <yunhong.jiang@intel.com>
Acked-by: Tim Deegan <Tim.Deegan@citrix.com>
15 years agox86: Add broken memory type in p2m table
Keir Fraser [Mon, 13 Sep 2010 16:47:40 +0000 (17:47 +0100)]
x86: Add broken memory type in p2m table

In some platform, whole system will crash if a broken memory is
accessed, no matter this access is from guest, or hypervisor. This may
cause issue if mallicious guest access this memory. To avoid this, we
need to guard the access from the guest. Morever, we need make sure
host will not access the memory for guest, like when do instruction
emulation.

This patch is to guard EPT guest's access. A new broken memory type is
added. Because the ept_p2m_type_to_flags() will mark default type as
r/w/x bit as zero, a broken memory type will have non-present EPT
entry, thus guest's access will cause EPT violation VM Exit.

In Xen hypervisor's vmexit ept violation handler, when it try to
translate the gpfn to mfn through p2m_guest query type, this patch
will cause domain to be crashed.

The changes to __gfn_to_mfn_type will return INVALID_MFN for broken
memory type, to avoid the crash caused by hypervisor access if caller
check the return value. It is complex to test this scenerior in EPT
situation, since mostly EPT violation will happen before hypervisor
will access the broken memory, but to be helpful for other memory
type.

Signed-off-by: Jiang, Yunhong <yunhong.jiang@intel.com>
Acked-by: Tim Deegan <Tim.Deegan@citrix.com>
15 years agoAllow easier overriding of LIBLEAFDIR_x86_64 on GNU systems
Keir Fraser [Mon, 13 Sep 2010 16:45:59 +0000 (17:45 +0100)]
Allow easier overriding of LIBLEAFDIR_x86_64 on GNU systems

Some GNU systems (including Debian) do not use /usr/lib64. This change
makes it easier to have the Xen build system on amd64 put its 64-bit
libraries files in /usr/lib.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
15 years agoFix an IO-APIC error message
Keir Fraser [Mon, 13 Sep 2010 16:44:19 +0000 (17:44 +0100)]
Fix an IO-APIC error message

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
15 years agoFix serial interrupt's destination
Keir Fraser [Mon, 13 Sep 2010 16:37:25 +0000 (17:37 +0100)]
Fix serial interrupt's destination

Lowest Priority can't use with invalid cpu_mask, and the default value
of CPU_MASK_ALL may cover CPU which wasn't online.

From: "Yang, Sheng" <sheng.yang@intel.com>
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
15 years agohvm: Merge MSR_EFER handling.
Keir Fraser [Mon, 13 Sep 2010 16:35:03 +0000 (17:35 +0100)]
hvm: Merge MSR_EFER handling.

Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
15 years agoDisable kernel build in Xen build system.
Keir Fraser [Mon, 13 Sep 2010 16:31:19 +0000 (17:31 +0100)]
Disable kernel build in Xen build system.

Cloning and building a kernel as part of the Xen distribution
implicitly advises that this kernel is the best kernel for all users
and many users appear to be under this impression, even though there
is no fundamental coupling between the Xen distribution and a
particular domain 0 kernel.

There are several choices available for domain 0 kernel, as well as
other user specific variations in requirements e.g. for kernel
configurations. It's not clear that whatever the xen build system
happens to produce (which is really tailored to the needs of the
automated build system) is best for anybody.

Coupling the kernel build with the Xen build has proved problematic
for stable Xen releases as it implicitly blesses the particular kernel
(at a particular point in time) as a constituent part of the Xen
release, while in reality the OS kernels are separate entities with
their own release cycles which may or may not coincide with the
maintenance of Xen stable branches.

Therefore disable the building of a kernel as part of the Xen
distribution by default and instead direct users to use an OS
distribution provided kernel (properly packaged with security updates
via the normal distribution mechanisms etc) where possible and give
pointers to suitable resources providing guidance for cases where it
is not.

This decouples the implicit advice as to the best kernel at any moment
from Xen's own release cycle and removes the implicit suggestion that
only particular domain 0 kernel will do.

The actual infrastructure is left in place since the automated test
system (currently) relies on it (but always asks for the specific
kernel variant it wants for a particular test).

(I also tried to remove Linux-isms from the README's Quick start
guide. In particular I'm not sure what was supposedly Linux specific
about steps 3 and 4 therefore I have removed the suggestion that they
are.)

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
15 years agoxen: define raw version of set_xen_guest_handle
Keir Fraser [Mon, 13 Sep 2010 16:29:53 +0000 (17:29 +0100)]
xen: define raw version of set_xen_guest_handle

allows users to define more complex (e.g. type-safer) variations on
set_xen_guest_handle if they wish.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
15 years agoxsm: Avoid null dereference in flask get_page_sid
Keir Fraser [Mon, 13 Sep 2010 16:27:22 +0000 (17:27 +0100)]
xsm: Avoid null dereference in flask get_page_sid

From: Daniel De Graaf <dgdegra@tycho.nsa.gov>

15 years agoThe sysctl hypercall should be callable from HVM guests.
Keir Fraser [Mon, 13 Sep 2010 16:26:49 +0000 (17:26 +0100)]
The sysctl hypercall should be callable from HVM guests.

Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
15 years agovmx: Unifying the CPU_BASED_VM_EXEC_CONTROL VMCS field write into a
Keir Fraser [Mon, 13 Sep 2010 16:25:42 +0000 (17:25 +0100)]
vmx: Unifying the CPU_BASED_VM_EXEC_CONTROL VMCS field write into a
single place for additional control that is required in nested VMX.

Signed-off-by: Qing He <qing.he@intel.com>
Signed-off-by: Eddie Dong <eddie.dong@intel.com>
15 years agovmx: Unifying the SECONDARY_VM_EXEC_CONTROL VMCS field write into a
Keir Fraser [Mon, 13 Sep 2010 16:25:11 +0000 (17:25 +0100)]
vmx: Unifying the SECONDARY_VM_EXEC_CONTROL VMCS field write into a
single place for additional control that is required in nested VMX.

Signed-off-by: Qing He <qing.he@intel.com>
Signed-off-by: Eddie Dong <eddie.dong@intel.com>
15 years agovmx: Caching the VMCS field EXCEPTION_BITMAP and cleanup some unused function.
Keir Fraser [Mon, 13 Sep 2010 16:24:44 +0000 (17:24 +0100)]
vmx: Caching the VMCS field EXCEPTION_BITMAP and cleanup some unused function.

Signed-off-by: Qing He <qing.he@intel.com>
Signed-off-by: Eddie Dong <eddie.dong@intel.com>
15 years agovmx: Rename host_vmcs to vmxon_region
Keir Fraser [Mon, 13 Sep 2010 16:24:10 +0000 (17:24 +0100)]
vmx: Rename host_vmcs to vmxon_region

For some reason, the memory region used for vmxon is named as
host_vmcs, which is somewhat misleading, rename it to vmxon_region as
SDM does.

Signed-off-by: Qing He <qing.he@intel.com>
Signed-off-by: Eddie Dong <eddie.dong@intel.com>
15 years agolibxc, tmem: Fix build after fd2e5008c2e0
Keir Fraser [Mon, 13 Sep 2010 16:17:01 +0000 (17:17 +0100)]
libxc, tmem: Fix build after fd2e5008c2e0

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
15 years agotmem (tools): move to new ABI version to handle long object-ids
Keir Fraser [Mon, 13 Sep 2010 16:11:04 +0000 (17:11 +0100)]
tmem (tools): move to new ABI version to handle long object-ids

After a great deal of discussion and review with linux
kernel developers, it appears there are "next-generation"
filesystems (such as btrfs, xfs, Lustre) that will not
be able to use tmem due to an ABI limitation... a field
that represents a unique file identifier is 64-bits in
the tmem ABI and may need to be as large as 192-bits.
So to support these guest filesystems, the tmem ABI must be
revised, from "v0" to "v1".

I *think* it is still the case that tmem is experimental
and is not used anywhere yet in production.

The tmem ABI is designed to support multiple revisions,
so the Xen tmem implementation could be updated to
handle both v0 and v1.  However this is a bit
messy and would require data structures for both v0
and v1 to appear in public Xen header files.

I am inclined to update the Xen tmem implementation
to only support v1 and gracefully fail v0.  This would
result in only a performance loss (as if tmem were
disabled) for newly launched tmem-v0-enabled guests,
but live-migration between old tmem-v0 Xen and new
tmem-v1 Xen machines would fail, and saved tmem-v0
guests will not be able to be restored on a tmem-v1
Xen machine.  I would plan to update both pre-4.0.2
and unstable (future 4.1) to only support v1.

I believe these restrictions are reasonable at this
point in the tmem lifecycle, though they may not
be reasonable in the near future; should the tmem
ABI need to be revised from v1 to v2, I understand
backwards compatibility will be required.

Signed-off-by: Dan Magenheimer <dan.magenheimer@oracle.com>
15 years agotmem (hv): move to new ABI version to handle long object-ids
Keir Fraser [Mon, 13 Sep 2010 16:10:14 +0000 (17:10 +0100)]
tmem (hv): move to new ABI version to handle long object-ids

After a great deal of discussion and review with linux
kernel developers, it appears there are "next-generation"
filesystems (such as btrfs, xfs, Lustre) that will not
be able to use tmem due to an ABI limitation... a field
that represents a unique file identifier is 64-bits in
the tmem ABI and may need to be as large as 192-bits.
So to support these guest filesystems, the tmem ABI must be
revised, from "v0" to "v1".

I *think* it is still the case that tmem is experimental
and is not used anywhere yet in production.

The tmem ABI is designed to support multiple revisions,
so the Xen tmem implementation could be updated to
handle both v0 and v1.  However this is a bit
messy and would require data structures for both v0
and v1 to appear in public Xen header files.

I am inclined to update the Xen tmem implementation
to only support v1 and gracefully fail v0.  This would
result in only a performance loss (as if tmem were
disabled) for newly launched tmem-v0-enabled guests,
but live-migration between old tmem-v0 Xen and new
tmem-v1 Xen machines would fail, and saved tmem-v0
guests will not be able to be restored on a tmem-v1
Xen machine.  I would plan to update both pre-4.0.2
and unstable (future 4.1) to only support v1.

I believe these restrictions are reasonable at this
point in the tmem lifecycle, though they may not
be reasonable in the near future; should the tmem
ABI need to be revised from v1 to v2, I understand
backwards compatibility will be required.

Signed-off-by: Dan Magenheimer <dan.magenheimer@oracle.com>
15 years agopage_alloc: Hold heap_lock while adjusting page states to/from PGC_state_free.
Keir Fraser [Mon, 13 Sep 2010 16:08:31 +0000 (17:08 +0100)]
page_alloc: Hold heap_lock while adjusting page states to/from PGC_state_free.

This avoids races with buddy-merging logic in free_heap_pages().

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
15 years agox86 vmx: Add handlers for missing exit_reasons documented by Intel SDM 3B
Keir Fraser [Mon, 13 Sep 2010 16:05:45 +0000 (17:05 +0100)]
x86 vmx: Add handlers for missing exit_reasons documented by Intel SDM 3B

Signed-off-by: Liu Yuan <yuan.b.liu@intel.com>
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
15 years agopage_alloc: Check neighbouring chunks belong to same NUMA node before
Keir Fraser [Mon, 13 Sep 2010 16:00:10 +0000 (17:00 +0100)]
page_alloc: Check neighbouring chunks belong to same NUMA node before
merging in free_heap_pages(). This avoids more convoluted logic in
init_heap_pages().

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
15 years agotools/xenstore: libxenstore: fix threading bug which cause xend startup hang
Ian Jackson [Fri, 10 Sep 2010 18:06:33 +0000 (19:06 +0100)]
tools/xenstore: libxenstore: fix threading bug which cause xend startup hang

If a multithreaded caller creates a thread which calls xs_read_watch,
before it has set any watches with xs_watch, the thread in
xs_read_watch will enter read_message and sit reading the xenstored fd
without the appropriate locks held.  Other threads can then
concurrently read the xenstored fd, which naturally does not work very
well.

Symptoms of this bug which I have been able to reproduce include
failure of xend startup to finish, due to a deadlock; results could
also include reading corrupted data from xenstore.

In this patch we arrange for xs_read_watch to always rely on the
reader thread created by xs_watch.  If no watches have been set, then
xs_read_watch will block until one has been.  If the library is
compiled non-threaded xs_read_watch unconditionally does the reading
in the current thread.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
15 years agooxenstored: when reading / read automatically the root node.
Vincent Hanquez [Fri, 10 Sep 2010 18:01:31 +0000 (19:01 +0100)]
oxenstored: when reading / read automatically the root node.

Signed-off-by: Vincent Hanquez <vincent.hanquez@eu.citrix.com>
15 years agoxl: Fix adding additional config cmdline parameters
Andre Przywara [Fri, 10 Sep 2010 17:57:47 +0000 (18:57 +0100)]
xl: Fix adding additional config cmdline parameters

When checking the size of the buffer we hold for additional
config parameters passed on the command line we should take the
size of the to-be-added string into account. While at it, rework
the implementation to be cleaner and safer.

Signed-off-by: Andre Przywara <andre.przywara@amd.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
15 years agoxl: fix adding configuration parameters on command line
Andre Przywara [Fri, 10 Sep 2010 17:57:28 +0000 (18:57 +0100)]
xl: fix adding configuration parameters on command line

Since we read the text file as is from the disk, there is no
trailing \0 at the end terminating the C string. Therefore we
must not use strcat to this buffer. Also we need to allocate
space for the trailing zero byte.

Signed-off-by: Andre Przywara <andre.przywara@amd.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
15 years agoxl: don't leak a lot of memory in forked process in domain_create
Gianni Tedesco [Fri, 10 Sep 2010 17:49:49 +0000 (18:49 +0100)]
xl: don't leak a lot of memory in forked process in domain_create

A goto statement skips over freeing data structures for no good reason.
It's not a real issue since the next step is to exit() but this cleans
up output of valgrind so that other leaks and errors can be spotted.

Signed-off-by: Gianni Tedesco <gianni.tedesco@citrix.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
15 years agolibxl: don't leak gc pointers to caller's structs; prevent double free
Gianni Tedesco [Fri, 10 Sep 2010 17:49:00 +0000 (18:49 +0100)]
libxl: don't leak gc pointers to caller's structs; prevent double free

libxl_build_device_model uses a pointer in a caller supplied data
structure to synthesize a vif-name if one is not supplied. This is bad
juju because the caller may want to free this pointer but by the time it
get's a chance the gc has already done so. Switch to using a local
variable for this pointer and avoid a double-free in the domain create
path.

Gianni Tedesco <gianni.tedesco@citrix.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
15 years agoxl: fix double free of domain names
Gianni Tedesco [Fri, 10 Sep 2010 17:47:53 +0000 (18:47 +0100)]
xl: fix double free of domain names

Assigning malloc'd variables from one structure to another when both of
them are free'd via destructors is a bad idea. Let's use a strdup.

Signed-off-by: Gianni Tedesco <gianni.tedesco@citrix.com>
15 years agoxl: remove another string literal from config struct
Ian Campbell [Fri, 10 Sep 2010 17:44:09 +0000 (18:44 +0100)]
xl: remove another string literal from config struct

Broken by 22124:098790dd9327 "xl: use xlu_cfg_replace_string in a few more places"

[ Identical patch submitted by both Ian C and Gianni ]

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Signed-off-by: Gianni Tedesco <gianni.tedesco@citrix.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
15 years agoxl: use xlu_cfg_replace_string in a few more places.
Ian Campbell [Thu, 9 Sep 2010 16:59:33 +0000 (17:59 +0100)]
xl: use xlu_cfg_replace_string in a few more places.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
15 years agolibxl, xl: don't free string literals in config structure
Gianni Tedesco [Thu, 9 Sep 2010 16:56:11 +0000 (17:56 +0100)]
libxl, xl: don't free string literals in config structure

The function init_dm_info() is initialising some strings from literals.
This is bad juju because when the destructor is called we cannot know if
the string literal was overridden with a strdup()'d value. Therefore
strdup values in the initialiser then introduce and use the function
libxlu_cfg_replace_string() which free's whatever is set before
strdupping the new value on top of it. The rule for the new call should
be clear due to const vs. non-const arguments - changing the behaviour
of libxlu_cfg_get_string() would cause more complexity than it saves.

[ fixed up for stray ! sign -iwj ]

Signed-off-by: Gianni Tedesco <gianni.tedesco@citrix.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
15 years agolibxl: move hvm_build_set_params to libxl_dom.c [part 2]
Ian Campbell [Wed, 8 Sep 2010 15:54:16 +0000 (16:54 +0100)]
libxl: move hvm_build_set_params to libxl_dom.c [part 2]

It is an internal function with only one caller.

[ This is the 2nd half of bd331cd1e704, which should have deleted
  tools/libxl/xenguest.c, which deletion I accidentally dropped -iwj ]

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
15 years agolibxl: Use libxl__ namespace for internal types
Ian Campbell [Wed, 8 Sep 2010 15:48:48 +0000 (16:48 +0100)]
libxl: Use libxl__ namespace for internal types

It's not clear that the namespace rules described in libxl.h are
intended to apply to internal types but I don't see why not.

sed -i -e 's/\<libxl_device\>/libxl__device/g'  tools/libxl/*.[ch]
sed -i -e 's/\<libxl_device_kinds\>/libxl__device_kinds/g'  tools/libxl/*.[ch]
sed -i -e 's/\<libxl_gc\>/libxl__gc/g'  tools/libxl/*.[ch]
sed -i -e 's/\<libxl_gc_owner\>/libxl__gc_owner/g'  tools/libxl/*.[ch]
sed -i -e 's/\<libxl_spawn_starting\>/libxl__spawn_starting/g'  tools/libxl/*.[ch]

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
15 years agolibxl: move hvm_build_set_params to libxl_dom.c
Ian Campbell [Wed, 8 Sep 2010 15:47:32 +0000 (16:47 +0100)]
libxl: move hvm_build_set_params to libxl_dom.c

It is an internal function with only one caller.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
15 years agolibxl: Ensure all _hidden functions use libxl__ prefix (manual part)
Ian Campbell [Wed, 8 Sep 2010 15:46:27 +0000 (16:46 +0100)]
libxl: Ensure all _hidden functions use libxl__ prefix (manual part)

This patch covers the remaining functions identified by:
  rgrep _hidden tools/libxl/*.h | grep -v libxl__

sed -i -e 's/XL_LOG/LIBXL__LOG/g' tools/libxl/*.[ch]
sed -i -e 's/xl_log/libxl__log/g' tools/libxl/*.[ch]
sed -i -e 's/\(build_\(pre\|post\|pv\|hvm\)\)/libxl__\1/g' tools/libxl/*.[ch]
sed -i -e 's/is_hvm/libxl__domain_is_hvm/g' tools/libxl/*.[ch]
sed -i -e 's/get_shutdown_reason/libxl__domain_shutdown_reason/g' tools/libxl/*.[ch]
sed -i -e 's/restore_common/libxl__domain_restore_common/g' tools/libxl/*.[ch]
sed -i -e 's/core_suspend/libxl__domain_suspend_common/g' tools/libxl/*.[ch]
sed -i -e 's/save_device_model/libxl__domain_save_device_model/g' tools/libxl/*.[ch]
sed -i -e 's/device_disk_backend_type_of_phystype/libxl__device_disk_backend_type_of_phystype/g' tools/libxl/*.[ch]
sed -i -e 's/\<libxl_blktap_enabled\>/libxl__blktap_enabled/g'  tools/libxl/*.[ch]
sed -i -e 's/\<libxl_blktap_devpath\>/libxl__blktap_devpath/g'  tools/libxl/*.[ch]

Add _hidden to libxl__blktap_enabled and libxl__blktap_devpath

Inline dominfo_libxl__domain_shutdown_reason(info) into
libxl__domain_shutdown_reason, its only caller.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
15 years agolibxl: Ensure all _hidden functions use libxl__ prefix (autogenerated patch)
Ian Campbell [Wed, 8 Sep 2010 15:44:24 +0000 (16:44 +0100)]
libxl: Ensure all _hidden functions use libxl__ prefix (autogenerated patch)

This patch covers all those which could be trivially converted automatically.

sed -n -e 's/_hidden.*[ \*]libxl_\([^_][^()]*\)(.*/\1/pg' tools/libxl/*.h | \
while read i ; do \
    sed -i -e "s/libxl_$i/libxl__$i/g" tools/libxl/*.[ch]; \
done

sed -n -e 's/_hidden.*_libxl_\([^_][^()]*\)(.*/\1/pg' tools/libxl/*.h | \
while read i ; do \
    sed -i -e "s/_libxl_$i/libxl__$i/g" tools/libxl/*.[ch]; \
done

Check that diffstat includes libxl but not xl.

Fixup tools/libxl/xl_cmdimpl.c which used libxl_device_del instead of
libxl_device_disk_del in a printf.

(Patch runes re-run by Ian Jackson to refresh against tip libxl.)

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
15 years agoxl: correct calls to dolog() (aka LOG)
Ian Jackson [Wed, 8 Sep 2010 15:35:40 +0000 (16:35 +0100)]
xl: correct calls to dolog() (aka LOG)

dolog, for which LOG is a macro wrapper, was lacking the printf format
attribute.  Add it, and fix the two problems revealed.

(Original patch for one of the occurrences from Ian Campbell.)

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
15 years agoxl: do not return to caller from monitoring daemon
Ian Campbell [Wed, 8 Sep 2010 15:24:20 +0000 (16:24 +0100)]
xl: do not return to caller from monitoring daemon

The parent process will have returned to the caller and done whatever
is necessary. The daemon should not return otherwise it will repeat
this work. In the case of the migration receiver this causes it to try
and take part in the migration protocol long after the sender+parent
process have completed it, leading to confusing error messages
(although strangely not much actual damange).

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
15 years agotools/debugger/gdbsx: use MTF flag for HVM guests for single step
Mukesh Rathor [Tue, 7 Sep 2010 18:17:16 +0000 (19:17 +0100)]
tools/debugger/gdbsx: use MTF flag for HVM guests for single step

The attached patch first tries the MTF flag for HVM guest
single step, reverting to manually setting the TF flag  if MTF fails.

Tested on 4.0.1. Compile tested on unstable.

Signed-off-by: mukesh.rathor@oracle.com
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
15 years agoremus: remove remus kernel extensions (now distributed with pvops kernel)
Brendan Cully [Tue, 7 Sep 2010 18:15:24 +0000 (19:15 +0100)]
remus: remove remus kernel extensions (now distributed with pvops kernel)

Note that 2.6.18 doesn't have these extensions, so as of this patch
Remus no longer supports 2.6.18 dom0 (2.6.18 is still the preferred
kernel for domU, since it contains the suspend event channel).

Signed-off-by: Brendan Cully <brendan@cs.ubc.ca>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
15 years agoremus: use plug qdisc for network buffering instead of queue
Brendan Cully [Tue, 7 Sep 2010 18:13:55 +0000 (19:13 +0100)]
remus: use plug qdisc for network buffering instead of queue

It was renamed in the pvops [kernel] tree.

Signed-off-by: Brendan Cully <brendan@cs.ubc.ca>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
15 years agolibxc: restore: reset I/O fd to flags to back to state caller passed us
Ian Campbell [Tue, 7 Sep 2010 18:13:01 +0000 (19:13 +0100)]
libxc: restore: reset I/O fd to flags to back to state caller passed us

In particular this causes us to turn O_NONBLOCK back off if we set it.

The caller may continue to use the fd for it's own protocol needs and
may not be prepared to have it become non-blocking.

This probably only effects Remus now after my previous patch to signal
the last checkpoint, since a regular migration will no longer set the
fd non-blocking.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Brendan Cully <brendan@cs.ubc.ca>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
15 years agolibxc: provide notification of final checkpoint to restore end
Ian Campbell [Tue, 7 Sep 2010 18:08:11 +0000 (19:08 +0100)]
libxc: provide notification of final checkpoint to restore end

When the restore code sees this notification it will restore the
currently in-progress checkpoint when it completes.

This allows the restore end to finish up without waiting for a
spurious timeout on the receive fd and thereby avoids unnecessary
error logging in the case of a successful migration or restore.

In the normal migration or restore case the first checkpoint is always
the last. For a rolling checkpoint (such as Remus) the notification is
currently unused but could be used in the future for example to
provide a controlled failover for reasons other than error

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Brendan Cully <brendan@cs.ubc.ca>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
15 years agolibxl: Fix NULL deref in libxl_ctx_free()
Gianni Tedesco [Tue, 7 Sep 2010 18:05:17 +0000 (19:05 +0100)]
libxl: Fix NULL deref in libxl_ctx_free()

xc_interface_close() will de-reference a NULL handle, check for this
condition in libxl_ctx_free() before calling.

Signed-off-by: Gianni Tedesco <gianni.tedesco@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
15 years agolibxl: ship libxl_uuid.h, to unbreak out-of-tree libxl builds
Gianni Tedesco [Tue, 7 Sep 2010 18:04:39 +0000 (19:04 +0100)]
libxl: ship libxl_uuid.h, to unbreak out-of-tree libxl builds

Broken since introduction of libxl_uuid.h which defines a core API
data-type but it's not installed in include directory.

Signed-off-by: Gianni Tedesco <gianni.tedesco@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
15 years agolibxl: include domain id in userdata path.
Ian Campbell [Tue, 7 Sep 2010 17:55:07 +0000 (18:55 +0100)]
libxl: include domain id in userdata path.

The userdata is specific to a particular incarnation of a domain and
the patch is therefor required to be unique to each incarnation. If
the user has explicitly configured a UUID in their domain
configuration then the path is no longer unique since
22124:22366e13f76d "xl: randomly generate UUIDs" which (correctly)
caused the uuid domain configuration option to be obeyed.

If userdata is not unique to each incarnation of a domain then
localhost live migration is broken because the target is created (and
writes its userdata) before the sender destroys the domain (and
deletes its userdata).

Strictly speaking I think the UUID is unnecessary but it is perhaps
helpful to people looking in the userdata directory, for debugging
etc.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
15 years agolibxl+xend: use correct paths for PV console when running bootloader
Ian Campbell [Tue, 7 Sep 2010 17:50:55 +0000 (18:50 +0100)]
libxl+xend: use correct paths for PV console when running bootloader

Makes "{xl,xm} create -c GUEST" work again with pygrub in interactive
mode which was broken by 21994:2e08ec0028e4

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Acked-by: Stefano Stabellini <Stefano.Stabellini@eu.citrix.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
15 years agoxl: do not run bootloader on restore.
Ian Campbell [Fri, 3 Sep 2010 17:44:49 +0000 (18:44 +0100)]
xl: do not run bootloader on restore.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
15 years agolibxc: use a switch statement in xc_domain_restore.c::pagebuf_get_one.
Ian Campbell [Fri, 3 Sep 2010 17:43:00 +0000 (18:43 +0100)]
libxc: use a switch statement in xc_domain_restore.c::pagebuf_get_one.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
15 years agolibxc: logger: add newline when progress is complete
Ian Campbell [Fri, 3 Sep 2010 17:41:37 +0000 (18:41 +0100)]
libxc: logger: add newline when progress is complete

In xc_domain_save ensure that we signal completion at the end of each
batch.

This ensures that the next logged line starts on a new line. e.g. instead of:
     Savefile contains xl domain config
    xc: Saving memory: iter 3 (last sent 0 skipped 0): 0/32768    0%migration target: Transfer complete, requesting permission to start domain.
    migration sender: Target has acknowledged transfer.
what is desired is:
     Savefile contains xl domain config
    xc: Saving memory: iter 0 (last sent 0 skipped 0): 32768/32768  100%
    xc: Saving memory: iter 1 (last sent 32576 skipped 192): 32768/32768  100%
    xc: Saving memory: iter 2 (last sent 217 skipped 0): 32768/32768  100%
    xc: Saving memory: iter 3 (last sent 0 skipped 0): 32768/32768  100%
    migration target: Transfer complete, requesting permission to start domain.
    migration sender: Target has acknowledged transfer.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
15 years agolibxc: document save/restore protocol
Ian Campbell [Fri, 3 Sep 2010 17:38:11 +0000 (18:38 +0100)]
libxc: document save/restore protocol

Reverse engineered from the code, likely contains inaccuracies but I
think provides a base to work from.

Add symbolic names for the minus-flags.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
15 years agoxend: reserve vtd_mem on guest restore
Miroslav Rezanina [Fri, 3 Sep 2010 17:22:31 +0000 (18:22 +0100)]
xend: reserve vtd_mem on guest restore

There's need for free vtd_mem more memory for guest with
xen-unstable c/s 17529.  This memory is freed when guest is
created, but is not freed when guest is restored. So restore
guest fails due  to not enough of memory for guest.

Following patch uses same calculation of memory to free in guest
restore as is in guest creation.

Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
15 years agoQEMU_TAG update
Ian Jackson [Thu, 2 Sep 2010 18:12:42 +0000 (19:12 +0100)]
QEMU_TAG update

15 years agoxl: do not continue in the child and exec xenconsole in the parent
Stefano Stabellini [Thu, 2 Sep 2010 17:26:00 +0000 (18:26 +0100)]
xl: do not continue in the child and exec xenconsole in the parent

Currenctly console_autoconnect spawns a child that continues building
the domain while the parent exec's xenconsole; this patch inverts the
logic.

As a consequence autoconnect_console needs to be called twice: once for
pv guests at the beginning and once for hvm guests at the end.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
15 years agolibxl: do not log lack of guest support for suspend event channel
Ian Campbell [Thu, 2 Sep 2010 17:16:28 +0000 (18:16 +0100)]
libxl: do not log lack of guest support for suspend event channel

Implementation of the suspend event channel is completely optional for
a guest so do not log this normal occurrence.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
15 years agoxl: support console autoconnect on restore
Ian Campbell [Thu, 2 Sep 2010 17:15:29 +0000 (18:15 +0100)]
xl: support console autoconnect on restore

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
15 years agoxl: randomly generate UUIDs
Gianni Tedesco [Thu, 2 Sep 2010 17:12:14 +0000 (18:12 +0100)]
xl: randomly generate UUIDs

This patch converts xl to randomly generate UUID's rather than using a
dodgy time-seeded PRNG. I have ignored various suggestions so far on
auto-generation of MAC addresses and left it as a topic for a future
patch to solve. In other words the behaviour stays the same it's just
using a true random source. This patch also implements the "uuid" config
file parameter in xl.

Signed-off-by: Gianni Tedesco <gianni.tedesco@citrix.com>
Acked-By: Christoph Egger <Christoph.Egger@amd.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
15 years agoxl: parse the maxvcpus config file parameter
Stefano Stabellini [Thu, 2 Sep 2010 16:44:46 +0000 (17:44 +0100)]
xl: parse the maxvcpus config file parameter

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
15 years agoMerge
Ian Jackson [Thu, 2 Sep 2010 15:51:53 +0000 (16:51 +0100)]
Merge

15 years ago[IA64] Rename irq_cfg->domain to irq_cfg->cpu_mask
Keir Fraser [Thu, 2 Sep 2010 12:36:53 +0000 (13:36 +0100)]
[IA64] Rename irq_cfg->domain to irq_cfg->cpu_mask

This patch is ia64 part of 22070:20920c12bc48.

Signed-off-by: KUWAMURA Shin'ya <kuwa@jp.fujitsu.com>
15 years agoVT-d: fix ia64 build
Keir Fraser [Thu, 2 Sep 2010 12:36:23 +0000 (13:36 +0100)]
VT-d: fix ia64 build

The identifier `dest_LowestPrio' is defined on only x86.

Signed-off-by: KUWAMURA Shin'ya <kuwa@jp.fujitsu.com>
15 years agoDisable ACPI APEI feature for ia64
Keir Fraser [Thu, 2 Sep 2010 12:35:40 +0000 (13:35 +0100)]
Disable ACPI APEI feature for ia64

The apei-io.c cannot be built on ia64.

Signed-off-by: KUWAMURA Shin'ya <kuwa@jp.fujitsu.com>
15 years agohvm_op: Remove use of uint64_aligned_t from guest header file.
Keir Fraser [Thu, 2 Sep 2010 12:30:26 +0000 (13:30 +0100)]
hvm_op: Remove use of uint64_aligned_t from guest header file.

Manually pad to the required alignment instead.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
15 years agoRevert 5b03813d8d6e "Make uint64_aligned_t and GUEST_HANDLE_64 visible to guests."
Keir Fraser [Thu, 2 Sep 2010 12:29:45 +0000 (13:29 +0100)]
Revert 5b03813d8d6e "Make uint64_aligned_t and GUEST_HANDLE_64 visible to guests."

This introduced non-ANSI gcc-isms into the guest-visible sections of
public headers. Not allowed after all.

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
15 years agotools/xenstore: correctly handle errors from read_message
Daniel De Graaf [Wed, 1 Sep 2010 13:37:18 +0000 (14:37 +0100)]
tools/xenstore: correctly handle errors from read_message

The return value of read_message needs to be checked in order to avoid
waiting forever for a message if there is an error on the communication
channel with xenstore. Currently, this is only checked if USE_PTHREAD is
defined (by checking for read thread exit), and that path is prone to
deadlock if request_mutex is held while waiting.

Since the failure of read_message leaves the socket in an undefined
state, close the socket and force all threads waiting on a read to return.

This also fixes xs_read_watch in the case where a read thread is not
running (in particular, this will happen if !USE_PTHREAD) by having it
read from the communication channel in the same way as read_reply.

Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>